import fs from "fs";
import path from "path";
import { encryptUTF8 } from "siphan";
import { addFilename, safeWrite } from './utils';
function encrypt(data, fileAddress) {
    var _a = encryptUTF8(data), cipher = _a.cipher, solution = _a.solution;
    safeWrite(addFilename(fileAddress, "-cipher"), cipher);
    safeWrite(addFilename(fileAddress, "-key"), solution);
}
export default function encryptMain(fileAddress) {
    fs.readFile(path.resolve(process.cwd(), fileAddress), function (err, data) {
        if (err !== null) {
            throw err;
        }
        encrypt(data.toString(), fileAddress);
    });
}
